package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInInvoice83;
import com.ims.core.doc.service.ITInInvoice83Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 83 电子发票（机动车销售统一发票） Controller
 *
 * @author IMS
 * @date 2024-11-26
 */
@RestController
@RequestMapping("/doc/jidongchexiaoshou")
public class TInInvoice83Controller extends BaseController
{
    @Autowired
    private ITInInvoice83Service tInInvoice83Service;

    /**
     * 查询83 电子发票（机动车销售统一发票） 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:jidongchexiaoshou:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInInvoice83 tInInvoice83)
    {
        startPage();
        List<TInInvoice83> list = tInInvoice83Service.selectTInInvoice83List(tInInvoice83);
        return getDataTable(list);
    }

    /**
     * 导出83 电子发票（机动车销售统一发票） 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:jidongchexiaoshou:export')")
    @Log(title = "83 电子发票（机动车销售统一发票） ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInInvoice83 tInInvoice83)
    {
        List<TInInvoice83> list = tInInvoice83Service.selectTInInvoice83List(tInInvoice83);
        ExcelUtil<TInInvoice83> util = new ExcelUtil<TInInvoice83>(TInInvoice83.class);
        util.exportExcel(response, list, "83 电子发票（机动车销售统一发票） 数据");
    }

    /**
     * 获取83 电子发票（机动车销售统一发票） 详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:jidongchexiaoshou:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInInvoice83Service.selectTInInvoice83ById(id));
    }

    /**
     * 新增83 电子发票（机动车销售统一发票） 
     */
    @PreAuthorize("@ss.hasPermi('doc:jidongchexiaoshou:add')")
    @Log(title = "83 电子发票（机动车销售统一发票） ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInInvoice83 tInInvoice83)
    {
        return toAjax(tInInvoice83Service.insertTInInvoice83(tInInvoice83));
    }

    /**
     * 修改83 电子发票（机动车销售统一发票） 
     */
    @PreAuthorize("@ss.hasPermi('doc:jidongchexiaoshou:edit')")
    @Log(title = "83 电子发票（机动车销售统一发票） ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInInvoice83 tInInvoice83)
    {
        return toAjax(tInInvoice83Service.updateTInInvoice83(tInInvoice83));
    }

    /**
     * 删除83 电子发票（机动车销售统一发票） 
     */
    @PreAuthorize("@ss.hasPermi('doc:jidongchexiaoshou:remove')")
    @Log(title = "83 电子发票（机动车销售统一发票） ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInInvoice83Service.deleteTInInvoice83ByIds(ids));
    }
}
